package tx.bjdacp.dao;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import tx.bjdacp.model.*;
import tx.bjdacp.dao.*;
import tx.bjdacp.service.*;
import tx.bjdacp.vo.query.*;


import static cn.org.rapid_framework.util.ObjectUtils.*;
import org.springframework.stereotype.Repository;

@Repository
public class GspInfoDao extends BaseHibernateDao<GspInfo,java.lang.Integer>{

	public Class getEntityClass() {
		return GspInfo.class;
	}

	public Page findPage(GspInfoQuery query) {
        // [column]为字符串拼接, {column}为使用占位符. [column]为使用字符串拼接,如username='[username]',偷懒时可以使用字符串拼接
        // [column] 为PageRequest的属性
		String sql = "select t from GspInfo t where 1=1 "
			  	+ "/~ and t.drugSellUnitId = {drugSellUnitId} ~/"
			  	+ "/~ and t.acceptCode like '%[acceptCode]%' ~/"
				+ "/~ and t.acceptDate >= {acceptDateBegin} ~/"
				+ "/~ and t.acceptDate <= {acceptDateEnd} ~/"
			  	+ "/~ and t.unitName like '%[unitName]%' ~/"
			  	+ "/~ and t.certType = {certType} ~/"
			  	+ "/~ and t.certKind = {certKind} ~/"
			  	+ "/~ and t.certResult = {certResult} ~/"
			  	+ "/~ and t.certBugItem like '%[certBugItem]%' ~/"
			  	+ "/~ and t.gspCode like '%[gspCode]%' ~/"
				+ "/~ and t.gspGiveDate >= {gspGiveDateBegin} ~/"
				+ "/~ and t.gspGiveDate <= {gspGiveDateEnd} ~/"
				+ "/~ and t.gspExpiryDate >= {gspExpiryDateBegin} ~/"
				+ "/~ and t.gspExpiryDate <= {gspExpiryDateEnd} ~/"
				+ "/~ and t.sendDate >= {sendDateBegin} ~/"
				+ "/~ and t.sendDate <= {sendDateEnd} ~/"
			  	+ "/~ and t.quarter = {quarter} ~/"
			  	+ "/~ and t.drugSellUnit.unitName like '%[drugSellUnit_unitName]%' ~/"
				+ "/~ order by [sortColumns] ~/";


		return pageQuery(sql,query);
	}


}
